#生成lua使用的PB文件
import os

from const import proto_path

outPath = "../Client/Assets/StreamingAssets/luaPb/"

luaProtoSrc = "./Proto/luaSrc"

def genLuaPb():
    
    #获取当前目录下的所有proto文件
    for fileFullName in os.listdir(luaProtoSrc):
        
        filename = os.path.splitext(fileFullName)[0]

        fileSuffix = os.path.splitext(fileFullName)[1]

        if fileSuffix == '.proto':
            
            execStr = "protoc --proto_path=./Proto/luaSrc  -o " + outPath + filename + ".pb "  + "./Proto/luaSrc/" + fileFullName

            os.system(execStr)

            print(execStr)

genLuaPb()
